package com.system.zuul.dao;

import com.system.zuul.model.ApiKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ApiKeyDao {
    @Select({"select * from api_key where userKey = #{key}"})
    ApiKey getApiKey(@Param("key") String key);

    @Select({"select count(0) from api_key where userKey = #{key}"})
    Integer getApiKeyCount(@Param("key") String key);

    @Update("update api_key set allRequestCount=allRequestCount+1 where userKey= #{key}")
    Integer addRequestCount(@Param("key") String key);

}
